#include <algorithm>
#include <iostream>
#include <functional>
#include <vector>
#include <string.h>
using namespace std;
void get_string_value(void *str_value) {
vector<int32_t> param(15, 99);
string _str_value;
auto fill_string_data = [&]() {
for (int i = 0; i < 15; i++) {
_str_value += to_string(param[i]);
if (i < param.size() - 1) {
_str_value += ",";
}
}
};
fill_string_data();
strncpy((char *)str_value, _str_value.c_str(), 1024);
}
int main() {
int a = 5;
int b = 8;
auto lambda1 = []{ cout << "Hello world\n"; };
std::function<void(int &a, int &b)> add = [a, b]() -> std::function<void(int &a, int &b)> {
cout << "a + b = " << (a + b) << endl;
return 0;
}();
cout << "a = " << a << endl;
cout << "b = " << b << endl;
lambda1();
vector<int> v{1, 2, 3, 4, 5, 6};
int sum = 0;
std::for_each(v.begin(), v.end(), [&sum] (const int& i) { sum += i; });
cout << "sum = " << sum << endl;
int sum2 = [](int x, int y){return (x + y);}(100, 101);
cout << "sum2 = " << sum2 << endl;
char value[1024];
get_string_value(value);
cout << "string values = " << value << endl;
return 0;
}